<?php

namespace App\Exports;

use Illuminate\Support\Collection;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithCustomValueBinder;
use Maatwebsite\Excel\Concerns\WithDrawings;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Cell\StringValueBinder;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;

//class CompanyExport implements FromCollection , WithHeadings, WithMapping, ShouldAutoSize, WithDrawings, WithEvents, FromView
class UserExport extends StringValueBinder implements FromView, WithCustomValueBinder
{
    private $data;
    private $role;

    public function __construct($data, $role)
    {
        $this->data = $data;
        $this->role = $role;
    }

    public function view(): View
    {

        return view('user.index', [
            'invoices' => $this->data,
            'role' => $this->role
        ]);
    }

}
